#!/usr/bin/env bash

ROOT=~/data/YLIMED/mp4_short_encode
TrainSplit=$ROOT/YLIMED_short_mp4_EvAll_split_train.txt
TestSplit=$ROOT/YLIMED_short_mp4_EvAll_split_test.txt
PosValSplit=$ROOT/YLIMED_short_mp4_Ev101_110_split_val.txt
DEVTrainSplit=$ROOT/YLIMED_short_mp4_EvAll_split_train_dev.txt
DEVTestSplit=$ROOT/YLIMED_short_mp4_EvAll_split_test_dev.txt
TOYSplit=$ROOT/YLIMED_short_mp4_EvAll_split_test_toy.txt

# echo $0
NAME=mv_res_resnet18_hid256
LOG=./out/$NAME/log
MODEL=./out/$NAME/weights
TEST_OUT=./out/$NAME/scores
#####################################################
# train
#####################################################
CUDA_VISIBLE_DEVICES=1 \
python train.py --arch resnet18 --data-name ylimed \
    --data-root  $ROOT \
    --train-list $TrainSplit \
    --test-list  $PosValSplit \
    --representation mv \
    --model-prefix $MODEL/ylimed \
    --lr      0.005 \
    --lstm_lr 0.005 \
    --hidden_size 256 \
    --batch-size 80 \
    --lr-steps 80 120 \
    --epochs 160 \
    --num_segments 3 \
    > $LOG/ylimed_mv_model.out 2>&1 &

CUDA_VISIBLE_DEVICES=2 \
python train.py --arch resnet18 --data-name ylimed \
    --data-root  $ROOT \
    --train-list $TrainSplit \
    --test-list  $PosValSplit \
    --representation residual \
    --model-prefix $MODEL/ylimed \
    --lr      0.001 \
    --lstm_lr 0.001 \
    --hidden_size 256 \
    --batch-size 80 \
    --lr-steps 80 110 \
    --epochs 130 \
    --num_segments 3 \
    > $LOG/ylimed_residual_model.out 2>&1 &

wait
################################################################
# test
################################################################
CUDA_VISIBLE_DEVICES=1 \
python test.py \
    --gpus 0 \
    --arch resnet18 --data-name ylimed --representation residual \
    --hidden_size 256 \
    --data-root $ROOT \
    --test-list $TestSplit \
    --weights $MODEL/ylimed_residual_model_best.pth.tar \
    --save-scores $TEST_OUT/ylimed_best_residual_model__scores \
    > $TEST_OUT/ylimed_best_residual_model__scores.out 2>&1 &
CUDA_VISIBLE_DEVICES=2 \
python test.py \
    --gpus 0 \
    --arch resnet18 --data-name ylimed --representation mv \
    --hidden_size 256 \
    --data-root $ROOT \
    --test-list $TestSplit \
    --weights $MODEL/ylimed_mv_model_best.pth.tar \
    --save-scores $TEST_OUT/ylimed_best_mv_model__scores \
    > $TEST_OUT/ylimed_best_mv_model__scores.out 2>&1 &

